< previous page page_490 next page >

Page 490
9f31265bb40b592b1929e18a47ab28e5.gif
   Set oRS = New Recordset
   oRS.Open strSQL, ConnectString(), _
            adOpenForwardOnly, adLockReadOnly
   oRS.Close

   Exit Sub

Error_EH:
   Call ErrorHandler(oRS.ActiveConnection)

   Exit Sub
End Sub
Figure 24.1 shows some sample output from this error-handling routine when you use the SQL Server OLE DB provider. Notice the description and the source properties.
8160-0490a.gif
Figure 24.1
Example of an error.
Command Objects
A Command object is a holder for a specific query that you want to execute against a data source. You can predefine the SQL and any parameters for that SQL, and then replace the parameters at runtime to execute the same SQL statement over and over again without having to redo the SQL statement each time.
Reasons to Use a Command Object
Heres a list of reasons why you would want to use a Command object:
You can pass in parameters and receive output parameters from a stored procedure.
You can reexecute the query with just an Execute command.

 
< previous page page_490 next page >

If you like this book, buy it!